/*
 * Copyright 2008 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.dopdf.document.hash.strategy;

import org.dopdf.document.read.DocumentReader;
import org.dopdf.utils.Constants;

/**
 * The pdf strategy delegate which will determin which fetching strategy to use and delegate the finding of pdf document
 * to the chosen strategy.  If no strategy match the criteria then we use the default strategy.
 *
 * @author Deep Shah
 */
public class DocumentHashingStrategyDelegate implements DocumentHashingStrategy {

    /** The document fetching strategy to be used. */
    private DocumentHashingStrategy documentHashingStrategy;

    /**
     * The constructor that takes in the strategy to use as argumnet.
     * @param documentFetchingStrategy the strategy to use.
     */
    public DocumentHashingStrategyDelegate(final Constants.PDFFetchingStrategy documentFetchingStrategy) {
        if(documentFetchingStrategy == Constants.PDFFetchingStrategy.LRU) {
            documentHashingStrategy = LRUBasedDocumentHashingStrategy.getInstance();
            return;
        }
    }

    /**
     * {@inheritDoc}
     */
    public String hash(final DocumentReader documentReader) {
        return null;
    }

    /**
     * {@inheritDoc}
     */
    public DocumentReader unHash(final String key) {
        return documentHashingStrategy.unHash(key);
    }
}
